home *** CD-ROM | disk | FTP | other *** search
- Path: peacock.tcinc.com!news
- From: Christopher Sweeney <csweeney>
- Newsgroups: comp.lang.c++
- Subject: Re: New C++ developers struggling with source configuration
- Date: 3 Jan 1996 15:56:56 GMT
- Organization: Tele-Communications, Inc.
- Message-ID: <4ce908$gcv@peacock.tcinc.com>
- References: <4ccfkd$7f5@azizia.dtm-corp.com>
- NNTP-Posting-Host: aitsun24.tcinc.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.12 (X11; I; SunOS 5.4 sun4m)
- X-URL: news:4ccfkd$7f5@azizia.dtm-corp.com
-
- pierce@dtm-corp.com (Pierce Krouse) wrote:
- >We have a configuration problem brewing here where I work. We have a
- >SCCS-based source code control system which has worked well in
- >developing C applications for unix platforms. We have library and
- >application program source directories. We are starting to develop
- >C++ classes and applications. The big question is whether libraries
- >are the way to share classes between application programs, or if there
- >is a better way to let application programs get to class objects. We
- >would prefer to have the Makefile that builds a given application
- >retrieve an object file rather than the source file (even though it is
- >all controlled under source code control). The problem is
- >containment: several classes inherit or contain other classes, so we
- >cannot just give the application program a single object file -- or
- >can we?
-
- Typically shared code is placed in archive (lib<something>.a) or shared
- (lib<something>.so) libraries. The linker's job is to resolve references in
- your code and the libraries, including internal library references.
-
- Unless you are not using the linker "properly", then the Makefile *does not*
- retrieve object files from libraries (regardless of C vs C++). Thus, placing
- classes/etc. in libraries is fundamentally the same as placing C functions in a
- library.
-
- The only caveat that I know of is Global Statics. Global Statics are *suppose*
- to be initialized prior
- to main being called (which is typically true). The compiler/linker need to
- manage calling these initializers. A while a go the SUN linker needed a
- "magic" .o explicitly added to the library so that the initializers would get
- called. In later releases this requirement went away.
-
- Note that global statics also have a problem with link-ordering in certain
- circumstances.
-
- Hope this helps.
- C.
-
-